<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" 	uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"  %>

<jsp:useBean id="manager" 	class="chat.bean.ChatRoomManager" scope="request" /> 
<jsp:setProperty name="manager" 	property="*" /> 

<c:set var="refCnt" value="${ param.refCnt + 1 }" /> 

<c:set var="chatRoom" value="${ manager.chatRoom }" />
<c:set var="chatMsgList" value="${ chatRoom.chatMsgList }" />  

<jsp:useBean id="chatMsg" 		class="chat.bean.ChatMsg" 		scope="request" 	/> 
<jsp:setProperty name="chatMsg"  property="*" />
<jsp:setProperty name="chatRoom" property="addChatMsg" value="${ chatMsg }" /> 

<jsp:useBean id="now" class="java.util.Date"/>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
	<meta http-equiv="refresh" 		content="5;URL=chatView.jsp?chatRoomId=${ param.chatRoomId }&refCnt=${ refCnt }#bottom" >
	
	<title>JSP Chat Message List </title>
</head>
<body>
	<div>
		<ul style="padding-left: 20px;" >
			<li>
				<fmt:formatDate value="${now}" pattern="yyyy-MM-dd HH:mm:ss" />
				:
				( ${ refCnt } )  
			</li> 
		</ul>
	</div>
	<div>
		<ol style="padding-left: 30px;" >
			<c:forEach items="${chatMsgList}" var="it" varStatus="status" >
				<li>
					<fmt:formatDate	  type="time" 	timeStyle="short" value="${ it.msgDate }"       />
					<br/>
					${ it.userName } : ${it.msgText } 
				</li>
			</c:forEach> 			
		</ol>
	</div>
	<div id="bottom" ></div> 
</body>
</html>